#include <stm8s_flash.h>

void FLASH_ProgramByte(uint32_t Address, uint8_t Data)
{
  /* Check parameters */
  assert_param(IS_FLASH_ADDRESS_OK(Address));

  /* Program byte */
#ifndef _SDCC_
  *(PointerAttr uint8_t*) (MemoryAddressCast)Address = Data;
#else
  write_byte_address(Address, Data);    // SDCC patch: required for far pointers
#endif // _SDCC_

}

/**
  * @brief  Reads any byte from flash memory
  * @note   PointerAttr define is declared in the stm8s.h file to select if 
  *         the pointer will be declared as near (2 bytes) or far (3 bytes).
  * @param  Address : Address to read
  * @retval Value of the byte
  */
